{% extends "management/base.html" %}
{% block title %}编辑图书{% endblock %}

{% block content %}

    <div class="container">
        <div class="row">
            <div class="col-md-6 col-md-offset-3 col-sm-10 col-sm-offset-1">
                {% if state == 'success' %}
                    <div class="well">
                        <h2 class="text-success text-center">编辑成功</h2>
                    </div>
                {% endif %}
                <form method="POST" role="form" class="form-horizontal">
                    {% csrf_token %}
                    <h1 class="form-signin-heading text-center">编辑图书</h1>

                    <div class="form-group">
                        <label for="id_name" class="col-md-3 control-label">书名：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" id="id_name" required name="name" value="{{ book.name }}" autofocus>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_author" class="col-md-3 control-label">作者：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" required name="author" id="id_author" value="{{ book.author }}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_category" class="col-md-3 control-label">类型：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" required name="category" id="id_category" value="{{ book.category }}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_price" class="col-md-3 control-label">价格：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" required name="price" id="id_price" value="{{ book.price }}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_pubdate" class="col-md-3 control-label">出版日期：</label>
                        <div class="col-md-9">
                            <input type="date" class="form-control" required name="publish_date" id="id_pubdate">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 col-md-offset-4">
                            <button class="btn btn btn-primary btn-block" type="submit">更新</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

{% endblock %}
